/*
import { SM4Util } from 'sm4util'

// 1.使用默认密钥进行加密/解密
var sm4 = new SM4Util()
// let key = 'TJwsXX_BzW=gJWJW';              ///---------------16位加密解密
let key = 'FE4636BC18CF308B2AE66EFDB910C0F7';
const miStr1 = sm4.encryptCustom_ECB('1223423', key) // sm4.encryptDefault_ECB(需要加密的字符串)
console.log('miStr1----', miStr1)
const jieStr1 = sm4.decryptCustom_ECB(miStr1, key) // sm4.decryptDefault_ECB(将字符串进行加密后生成的字符串)
console.log('jieStr1----', jieStr1) // 123
*/
// --------------------------------------32加密解密------------------------------
import {SM4} from "gm-crypto";
let encryptedData, decryptedData
const key = 'FE4636BC18CF308B2AE66EFDB910C0F7' // Any string of 32 hexadecimal digits
const originalData = 'SM4这是描述信息 国标对称加密'

// ECB
encryptedData = SM4.encrypt(originalData, key, {
    inputEncoding: 'utf8',
    outputEncoding: 'base64'
})
decryptedData = SM4.decrypt(encryptedData, key, {
    inputEncoding: 'base64',
    outputEncoding: 'utf8'
})


console.log("encrypt==="+encryptedData)
console.log("decrypt==="+decryptedData)

